package a5.grammar.grammars;

import javax.inject.Singleton;

import a5.common.ProgramCursor;
import a5.environment.Environment;
import a5.grammar.abs.GrammarImpl;
import a5.grammar.productions.Program;

/**
 * A Grammar which uses the {@link a5.grammar.productions.Program Program} production 
 * as its start terminal.
 * 
 * @author Jason Campos
 * @version Assignment 5, CS 152 (Programming Paradigms) Fall 2012, Jeffrey Smith
 */
@Singleton
public class G1 extends GrammarImpl{
	/*
	 * (non-Javadoc)
	 * @see a5.grammar.interfaces.Grammar#interpret(a5.environment.Environment, a5.common.ProgramCursor)
	 */
	@Override
	public String interpret(Environment environment, ProgramCursor cursor){
		// The start production for this grammar is Program
		return getProduction(Program.class).interpret(environment, cursor);
	}

	/*
	 * (non-Javadoc)
	 * @see a5.grammar.interfaces.Grammar#parse(a5.common.ProgramCursor)
	 */
	@Override
	public String parse(ProgramCursor cursor) {
		return getProduction(Program.class).parse(cursor).toString();
	}
}
